package cn.mhome.merchant.framework.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.mhome.merchant.entity.common.result.DataResult;
import cn.mhome.merchant.entity.common.result.Pager;
import cn.mhome.merchant.entity.system.param.SysUserParam;
import cn.mhome.merchant.entity.system.result.SysUserResult;
import cn.mhome.merchant.server.system.service.SysUserService;

/**
 * 系统用户管理
 * @author lvpeng
 */
@Controller
@RequestMapping("/system/user")
public class SysUserController {
	
	@Resource
	private SysUserService sysUserService;
	
	/**
	 * 查询用户列表
	 * @param sysUserParam
	 * @return
	 */
	@RequestMapping(value = "/findForPage", method = { RequestMethod.POST,
			RequestMethod.GET }, produces = "application/json;charset=UTF-8")
	@ResponseBody
	public DataResult findForPage(@RequestBody SysUserParam sysUserParam){
		DataResult dataResult = new DataResult();
		try {
			Pager<SysUserResult> data = sysUserService.findForPage(sysUserParam);
			dataResult.setData(data);
		} catch (Exception e) {
			dataResult.setCode(500);
			dataResult.setMsg("查询用户列表异常");
		}
		return dataResult;
	}
}
